#include "stdafx.h"
string get_scalar(const ynode & node)
{
	string s;
	switch(node.Type())
	{
	case YAML::NodeType::Scalar:
		node >> s;
		return s;
	case YAML::NodeType::Null:
		return string("void");
	default: 
		assert(0 && "error, neither null or scalar !");
	}
}
void set_mask8(unsigned char & mask, unsigned char value, bool set)
{
	if(set)
		mask |= value;
	else
		mask &= ~ (0 | value); // unsets
}
void set_mask16(unsigned short & mask, unsigned short value, bool set)
{
	if(set)
		mask |= value;
	else
		mask &= ~ (0 | value); // unsets
}
string tabulate(string s, size_t z)
{
    string a;
    for(size_t i = 0; i < z - s.size(); ++ i)
        a.append(" ");
    return s+a;
}